This repository was archived by the owner on Apr 25, 2026. It is now read-only.
feat: Slashing Queue#793
Merged
Merged
Conversation
drewstone
suggested changes
Oct 15, 2024
drewstone
left a comment
Contributor
There was a problem hiding this comment.
Looks good besides comments provided. Please address and please consider pulling out the logic into separate files once we get the service-update branch in a good state.
| let own_slash = percent.mul_floor(own_stake); | ||
| let others_slash = delegators | ||
| .into_iter() | ||
| .map(|(delegator, stake, _asset_id)| (delegator, percent.mul_floor(stake))) |
Contributor
There was a problem hiding this comment.
Why remove knowledge of the asset when you return it? Isn't this necessary across all assets being used by the service?
Contributor
Author
There was a problem hiding this comment.
we currently treat them equally, i.e if the slash is 10%, then we slash every delegator's stake by the 10% regardless of the asset kind. this not ideal of course, since not all assets are equal. Until we have an interface to map everything to Native token (TNT) we can take asset kind into account.
drewstone
added a commit
that referenced
this pull request
Oct 22, 2024
* feat: Slashing Queue (#793) * feat: Slashing Queue * feat: Per Service restaking percentage exposure * test: add more tests for the unapplied slash * feat: slashing precompile (#795) * feat: slashing precompile * feat: Slashing and Dispute precompiles * Update subxt * test: add more tests to cover more cases * doc: Update internal functions docs * chore: Update toml formatting * lint: fix clippy * chore: update tangle-subxt version --------- Co-authored-by: shekohex <dev+github@shadykhalifa.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Changes introduced in this pull request:
This pull request includes several significant changes to the
pallets/multi-asset-delegationandpallets/servicesmodules, focusing on adding new functionalities, refining existing ones, and removing deprecated features.New Functionalities:
get_delegators_for_operatormethod inMultiAssetDelegationInfotrait to retrieve delegators for a given operator. (pallets/multi-asset-delegation/src/traits.rs)SlashDeferDurationandSlashOrigintypes for managing slashing actions and deferring slashes. (pallets/services/src/lib.rs)UnappliedSlashevent and storage for managing unapplied slashes. (pallets/services/src/lib.rs) [1] [2]Refinements:
approvemethod to include arestaking_percentparameter, allowing operators to specify the percentage of restaked tokens exposed to the service. (pallets/services/src/lib.rs)requestmethod to simplify the process and removed the approval preference logic. (pallets/services/src/lib.rs) [1] [2] [3]Removals:
update_approval_preferencemethod and related event, as well as deprecated theServiceRequestUpdatedevent. (pallets/services/src/lib.rs) [1] [2] [3]Minor Changes:
approvalfield fromOperatorPreferencesstruct. (pallets/services/src/benchmarking.rs)sp_runtime::Percentimport for percentage calculations. (pallets/services/src/lib.rs)These changes collectively enhance the flexibility and functionality of the modules, while also cleaning up outdated code.
Reference issue to close (if applicable)
Closes #775